package edu.cmu.javadb.plan;


import java.util.*;

import edu.cmu.javadb.plan.condition.Path;
import edu.cmu.javadb.plan.visitor.Visitor;


public class Flattenation extends PlanNode {
	
	private PlanNode child = null;
	
	public Flattenation() {
		
	}
	public Flattenation(PlanNode child) {
		this.child = child;
	}
	
	@Override
	public <T> T accept(Visitor<T> visitor) {
		return visitor.visitNode(this);
	}
	
	public PlanNode getChild() {
		return child;
	}
	

	public void setChild(PlanNode child) {
		this.child = child;
		this.child.setFather(this);
	}
	
	@Override
	public String toString() {
		return "Flatten" + "[" + getName() + "]";
	}


	@Override
	public <T> void visitChildren(Visitor<T> visitor) {
		child.accept(visitor);
	}

	@Override
	public boolean containsRelation(String name) {
		if (this.name.equals(name))
			return true;
		return child.containsRelation(name);
	}
}
